<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>文本居中</title>
  <style type="text/css">
    div {
      border: 1px blue solid; /*顺序不要求*/
      width: 300px;
      background: aliceblue;
      font-size: 40px;
      font-weight: bold;
      font-family: 新宋体;
      margin-left: auto;
      margin-right: auto;
      text-align: center;
    }
  </style>
</head>
<body>
<div>小勤学CSS</div>
</body>
</html>